package com.javaymw.demo.config;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import com.javaymw.demo.interceptor.OAuth2Interceptor;

/**
 * web配置类
 * @author zhaoxinguo
 */
@Configuration
public class WebConfiguration implements WebMvcConfigurer {

	//认证拦截器
	@Autowired
	private OAuth2Interceptor oAuth2Interceptor;
	
	//重写添加拦截器方法并添加配置拦截器
	@Override
	public void addInterceptors(InterceptorRegistry registry) {
		registry.addInterceptor(oAuth2Interceptor).addPathPatterns("/**");
	}
	
}
